<template>
  <div id="app">
    <input type="text" :placeholder="tips" v-model="name">
<div>您的名字是{{ name }} 反转的结果是：{{ name.split('').reverse().join('') }}</div>
<button @click="noreverse">我又不想反转了</button>
 <div>
      <h3>折叠面板demo</h3>
      <div class="title">
        <h4>芙蓉楼送辛渐</h4>
        <button class="btn" @click="btn">
          <!--根据 isShow 的值显示 收起/隐藏-->
          {{ isShow ? '收起' : '展开'}}
        </button>
      </div>
      <!--v-show配合标签的隐藏和显示-->
      <div class="container" v-show="isShow">
        <p>寒雨连江夜入吴</p>
        <p>平明送客楚山孤</p>
        <p>洛阳亲友如相问</p>
        <p>一片冰心在玉壶</p>
      </div>
      <div v-show="isShow2">标题<button @click="btn2">编辑</button></div>
<div v-show="isShow1">
        标题：<input type="text" :placeholder="tips1">
        <br>
        频道：<input type="text" :placeholder="tips2">
        <br>
        <button>确认</button> <button @click="btn3">取消</button>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "App",
  
  data() {
    return {
      tips2:'前端',
      tips1:'如何成为前端老鸟',
 tips:"请输入您的用户名",
 name:'',
 isShow: true,
 isShow1: false,
 isShow2: true,
    };
  },
  methods: {
    noreverse()
    {
      this.name=this.name.split('').reverse().join('')
    },
    btn(){
      this.isShow = !this.isShow
    },
    btn2(){
      this.isShow1 = !this.isShow1,
      this.isShow2 = !this.isShow2
    },
    btn3(){
      this.isShow1 = !this.isShow1,
      this.isShow2 = !this.isShow2
    }
  },
};
</script>

<style>
div {
  color: purple;
  text-align: center;
}

body {
  background-color: #ccc;
  }
  #app {
    width: 400px;
    margin: 20px auto;
    background-color: #fff;
    border: 4px solid purple;
    border-radius: 1em;
    box-shadow: 3px 3px 3px rgba(0, 0, 0, 0.5);
    padding: 1em 2em 2em;
    }
    h3 {
      text-align: center;
    }
    .title {
      display: flex;
      justify-content: space-between;
      align-items: center;
      border: 1px solid #ccc;
      padding: 0 1em;
    }
    .title h4 {
      line-height: 2;
      margin: 0;
    }
    .container {
      border: 1px solid #ccc;
      padding: 0 1em;
    }
    .btn {
      /* 鼠标改成手的形状 */
      cursor: pointer;
    }
</style>
